const http = require('http');
const url = require('url');
const ejs = require('ejs');
http.createServer((req, res) => {
    let pathname = url.parse(req.url).pathname;
    if(pathname === '/login'){
        let data = '后台数据渲染';
        let list = ['aaa','bbb', 'ccc'];
        ejs.renderFile('views/login.ejs',{
            msg:data,
            list:list
        },(err,data)=>{
            res.end(data);
        })

    }else{
        console.log('error')
    }
}).listen(3000);